# 空气质量查询表
def airtab():
    global num
    if 0 <= num <= 50:
        print("空气质量：优", '\033[6;30;42m' + '    ' + '\033[0m')
    elif 50 < num <= 100:
        print("空气质量：良", '\033[6;30;43m' + '    ' + '\033[0m')
    elif 100 < num <= 150:
        print("空气质量：轻度污染", '\033[6;30;46m' + '橙色' + '\033[0m')
    elif 150 < num <= 200:
        print("空气质量：重度污染", '\033[6;30;41m' + '    ' + '\033[0m')
    elif 200 < num <= 300:
        print("空气质量：重度污染", '\033[6;30;45m' + '棕色' + '\033[0m')
    else:
        print("空气质量：严重污染", '\033[6;30;40m' + '    ' + '\033[0m')


while 1:
    print("--------------------------")
    print("提示按'Q'退出")
    num = input("请输入你要查询的空气质量：")
    if num.isdigit():
        num = int(num)
        if num < 0:
            print("请输入正确的数值！")
        else:
            airtab()
    elif num == "Q":
        print("欢迎下次使用！")
        break
    else:
        print("请输入正确内容！")
